#include <iostream>;
using namespace std;

enum TYPE{HORSE , PEGASUS};

class Horse
{
public:
	virtual void gallop(){cout << "horse....\n";}
};

class Pegasus : public Horse
{
public:
	virtual void fly(){cout<<"Pegasus flying...\n";}
};

const int numberHorse = 5;
int main()
{
	Horse *arr[numberHorse];
	Horse *pHorse;
	int choice,i;
	for(i = 0; i < numberHorse; i ++)
	{
		cout << "(1)Horse , (2)Pegasus: ";
		cin >> choice;
		if (choice == 2)
			pHorse = new Pegasus;
		else
			pHorse = new Horse;
		arr[i] = pHorse;
	}
	for (i = 0; i < numberHorse; i ++)
	{
		Pegasus *pPegasus = dynamic_cast<Pegasus*>(arr[i]);
		if(pPegasus != NULL)
			pPegasus->fly();
		else
			cout << "just a horse!!\n";
		delete arr[i];
	}
	return 0;
}